<?php
namespace Common\Logic;

/**
 * 用户相关逻辑层
 * @modify trainyao 2016-04-21 创建
 */
class SpecialLogic extends \Common\Controller\BaseController
{
	/**
     * 
     * 
     * 
     * @param  string   $hotelId    
     * @return Boolean              存在返回用户信息,不存在返回false
     */
    public function specialInfo($hotelId) {
        $hotelSpecialModel = D('HotelSpecial');
        $hotelSpecialDetail = $hotelSpecialModel->getInfoByHotel($hotelId);

        if (empty($hotelSpecialDetail)) {
            $hotelSpecialDetail = array();
        }

        $hotelDetail = D('HotelDetail')->getNameByHotel($hotelId);

        // 获取客栈房型最低价
        Vendor('phpRPC.phprpc_client');
        $client = new \PHPRPC_Client(C('HOTEL_RPC_URL'));
        $client->setEncryptMode(3);
        $RPCData = array(
            'flag' => C('MEIZHU_RPC_FLAG'),
            'time' => time(),
            'hotelId' => $hotelId,
        );
        $result = $client->getHotelPrice($RPCData);

        if (!empty($result['data'])) {
            $hotelSpecialDetail['minPrice'] = $result['data']['minPrice'];
        } else {
            $hotelSpecialDetail['minPrice'] = '';
        }
        $hotelSpecialDetail['hotelname'] = $hotelDetail;

        return $hotelSpecialDetail;
    }
}